//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package 力扣.题库.未分类;

public class demo_1275 {
    public demo_1275() {
    }

    public static void main(String[] args) {
        System.out.println(tictactoe(new int[][]{{0, 0}, {1, 1}, {0, 1}, {0, 2}, {1, 0}, {2, 0}}));
    }

    public static String tictactoe(int[][] moves) {
        String[][] board = new String[][]{{"", "", ""}, {"", "", ""}, {"", "", ""}};

        for(int i = 0; i < moves.length; i += 2) {
            board[moves[i][0]][moves[i][1]] = "A";
        }

        for(int i = 1; i < moves.length; i += 2) {
            board[moves[i][0]][moves[i][1]] = "B";
        }

        if (!board[0][0].isEmpty() && board[0][0].equals(board[0][1]) && board[0][0].equals(board[0][2])) {
            return board[0][0];
        } else if (!board[0][0].isEmpty() && board[0][0].equals(board[1][0]) && board[0][0].equals(board[2][0])) {
            return board[0][0];
        } else if (!board[2][2].isEmpty() && board[2][2].equals(board[2][1]) && board[2][2].equals(board[2][0])) {
            return board[2][2];
        } else if (!board[2][2].isEmpty() && board[2][2].equals(board[0][2]) && board[2][2].equals(board[1][2])) {
            return board[2][2];
        } else if (!board[1][1].isEmpty() && board[1][1].equals(board[0][0]) && board[1][1].equals(board[2][2])) {
            return board[1][1];
        } else if (!board[1][1].isEmpty() && board[1][1].equals(board[0][1]) && board[1][1].equals(board[2][1])) {
            return board[1][1];
        } else if (!board[1][1].isEmpty() && board[1][1].equals(board[0][2]) && board[1][1].equals(board[2][0])) {
            return board[1][1];
        } else if (!board[1][1].isEmpty() && board[1][1].equals(board[1][2]) && board[1][1].equals(board[1][0])) {
            return board[1][1];
        } else {
            for(int i = 0; i < 3; ++i) {
                for(int j = 0; j < 3; ++j) {
                    if (board[i][j].isEmpty()) {
                        return "Pending";
                    }
                }
            }

            return "Draw";
        }
    }
}
